The present invention relates to management of computer system memory space and more particularly to efficient use of CPU cycles in reclamation of computer memory space using an improvement in automatic memory management (sometimes called garbage collection) technology.
When computer programs are running or executing in a computer system, the computer system must allocate memory space, usually RAM (Random Access Memory) space, to hold objects required by those programs. The term “object” is a generic one and can refer to any data structure required by running programs. Examples of objects include, but are not limited to data structures defining instructions, numeric data, images, or, in object-oriented programming, a concrete instance of a class that consists of data and operations associated with that data.
Memory locations allocated to object storage are sometimes referred to as a “heap space” or simply a “heap”, terms that will be used frequently in the following description.
If objects loaded into a heap are never removed, the heap space can be exhausted and unavailable for new objects required by running programs. If that happens, it can be expected that the program requiring those new objects will fail somehow, perhaps generating unintended results while continuing to run or simply failing to run, a condition sometimes referred to as a program crash.
To reduce the possibility that heap space will become exhausted, automatic memory management technology has been developed. In simple terms, a automatic memory management program periodically examines objects stored in the heap to determine whether those objects are still needed by running programs. If the memory management program decides that an object is no longer needed, the memory space allocated to that object is reclaimed, making the freed space available for new objects. Typically, a memory management program also defragments the heap by packing the remaining objects into contiguous memory space, thus freeing up a greater amount of contiguous memory space for new objects.